/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase2203 - C3
 * <p>Powered by webrx On 2022-07-19 10:00:16
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class C3 {
    public static void main(String[] args) {
        //调用执行
        var c = new C3();
        System.out.println(c.max());
        System.out.println(c.max(6,100,0,5,3,2));


        System.out.println(c.sum(3,6));
        System.out.println(c.sum(3,6,9,10,20,100));
    }

    /**
     * Description: 一个返回值，参数个数不确定，类型确定了
     * @date: 2022/7/19 10:01
     * @params: [int...]
     * @return: int
     */
    public int max(int...n){
        //在此n形参变量 相当于一个数组
        int m = 0;
        for(int t : n){
            if(t>m){
                m = t;
            }
        }
        return m;
    }


    public int sum(int a,int b,int...c){
        int s = a+b;
        for(int t:c){
            s+=t;
        }
        return s;
    }
}
